Managing data in USB communication

ABSTRACT

In a case where a changeover request indicating to change over setting of an end point is received from an external apparatus, an information processing apparatus decides whether or not data is being transferred from the end point to a memory of the information processing apparatus. Then, in a case where it is decided that the data is being transferred from the end point to the memory, the information processing apparatus does not change over the setting of the end point.

BACKGROUND OF THE INVENTION

Field of the Invention

The present invention relates to an information processing apparatuswhich prevents that data received from a USB (universal serial bus) hostis lost, a controlling method for the information processing apparatus,and a storage medium for storing therein a computer program to achievethe controlling method.

Description of the Related Art

In general, a host apparatus such as a PC (personal computer) or thelike and peripherals such as an MFP (multifunction peripheral), aprinter and the like are mutually connected via various I/F's(interfaces) to perform data communication of print data and the like.For example, a USB has widely been used as one of the various I/F's.

In the USB standard, to use a common driver for each application, a USBdevice class specification has been defined in correspondence with akind of peripheral (USB Function). Also, in a printer classspecification, necessary transfer modes and the number of End Pointsserving as transmission/reception buffers have been defined. Thus, a USBprinter class driver can be used based on this specification.

The print data from the PC is transferred to the MFP by data transfercalled a Bulk Out from a USB host to the direction of the USB Function.

In the MFP, the data stored in the End Point serving as thetransmission/reception buffer is transferred to a RAM (random accessmemory) serving as an internal data storage area by using a DMAC(dynamic memory access controller).

In the USB standard, the high-speed USB 3.0 (maximum data communicationspeed is 5 Gbps) has been put to practical use. For this reason, thereis a problem that more data cannot be received in the state that the EndPoints serving as the transmission/reception buffers have been filledwith the data.

In this connection, Japanese Patent Application Laid-Open No. 2008-15823discloses the technique of changing the size of a transmission/receptionbuffer in response to an instruction from a USB host.

SUMMARY OF THE INVENTION

The USB Function, for which an alternate (or substitute) setting calledan Alternate Setting has been defined, can have a plurality of settingsof the End Point serving as the transmission/reception buffer. However,if the setting of the End Point is changed over, the data which has beenstored in the End Point is lost.

Therefore, in the present invention, there is provided an informationprocessing apparatus which is communicable with an external apparatusvia a USB cable, and comprises: a memory; a transferring unit configuredto transfer data stored in an end point, from the end point to thememory; a deciding unit configured to decide whether or not the data isbeing transferred from the end point to the memory, in a case where achangeover request indicating to change over setting of the end point isreceived from the external apparatus; and a controlling unit configuredto change over the setting of the end point according to the changeoverrequest in a case where it is decided by the deciding unit that the datais not being transferred from the end point to the memory, and not tochange over the setting of the end point in a case where it is decidedby the deciding unit that the data is being transferred from the endpoint to the memory.

Further features of the present invention will become apparent from thefollowing description of exemplary embodiments with reference to theattached drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram mainly illustrating an example of a hardwareconstitution of an MFP.

FIGS. 2A and 2B are diagrams each illustrating an example of an internalhardware constitution of a USB I/F.

FIGS. 3A, 3B, 3C and 3D are diagrams for describing a transferringoperation of print data from a PC along a time axis.

FIG. 4 is a sequence diagram for describing an example of an informationprocess by the PC and the MFP.

FIG. 5 is a flow chart for describing a response operation to anAlternate changeover request to be performed by the MFP.

DESCRIPTION OF THE EMBODIMENTS

Hereinafter, preferred embodiments of the present invention will now bedescribed in detail in accordance with the accompanying drawings.

First Embodiment

FIG. 1 is a block diagram illustrating an example of a systemconfiguration of an image forming system and an example of a hardwareconstitution of an MFP.

The image forming system comprises an MFP 1000 and a PC 2000, as thesystem configuration.

In the image forming system, the MFP 1000 and the PC 2000 are connectedto each other via a SUB cable 3000. Here, the MFP 1000 is an example ofan information processing apparatus which serves as a USB Function, andthe PC 2000 is an example of an external apparatus which serves as a USBHost.

The MFP 1000 comprises a controller 100, an operation unit 110, areading unit 120, and a printing unit 130. The MFP 1000 serves as aprinting apparatus which can perform printing.

The controller 100 controls the USB communication to be performed by theMFP 1000, and wholly controls the functional blocks of the MFP. Thecontroller 100 comprises a CPU (central processing unit) 101, a ROM(read only memory) 102, a RAM (random access memory) 103, an imageprocessing unit 104, an operation unit I/F 105, a reading unit I/F 106,a printing unit I/F 107, and a USB I/F (USB Function) 200.

The CPU 101 controls each functional block in the controller 100. TheROM 102 stores therein the control programs of the controller 100. TheRAM 103 serves as a control program execution area of the controller100, a working data area for image processes, and a data storage area.The image processing unit 104 performs the image process of thecontroller 100. The operation unit I/F 105 controls the I/F between thecontroller and the operation unit 110. The reading unit I/F 106 controlsthe I/F between the controller and the reading unit 120. The printingunit I/F 107 controls the I/F between the controller and the printingunit 130. The USB I/F 200 controls the USB communication with the PC2000.

On the premise that the CPU 101 performs the processes based on theprograms stored in the ROM 102 and the like, the later-describedfunctions of the MFP 1000, the process of the MFP in the later-describedsequence diagram, and the process in the later-described flow chart areachieved. Incidentally, the RAM 103 is an example of an internal memory.

The PC 2000 comprises a USB I/F (USB Host) 2100. The USB I/F 2100controls the USB communication with the MFP 1000.

Moreover, the PC 2000 has at least a CPU, and memories such as a RAM, aROM and the like as the hardware constitution. Thus, on the premise thatthe CPU of the PC 2000 performs the processes based on the programsstored in the memory of the PC 2000, the later-described functions ofthe PC 2000, and the process of the PC in the later-described sequencediagram are achieved.

FIGS. 2A and 2B are diagrams each illustrating an example of theinternal hardware constitution of the USB I/F 200.

As illustrated in each of FIGS. 2A and 2B, the USB I/F 200 comprises aPHY (physical layer circuit) 210, an internal bus I/F 220, and a USBcontrolling unit 230.

The PHY 210 performs the USB communication.

The USB controlling unit 230 controls the USB communication and datatransfer to the RAM 103.

The internal bus I/F 220 is the internal data path provided in the USBI/F 200, and the USB controlling unit 230 comprises an End Point 0 231and an Interface 234.

The End Point 0 231 transfers control data.

The Interface 234 comprises an End Point 1 232, and an End Point 2 233.Each of the End Point 1 232 and the End Point 2 233 is an example of abuffer.

Since an alternate setting called an Alternate Setting has been definedfor the USB Function, the USB Function can have a plurality of settingsfor the End Point serving as a transmission/reception buffer.

In FIGS. 2A and 2B, the settings of the End Point 1 and the End Point 2are respectively different.

In FIG. 2A, the End Point 1 has the setting of Bulk Out, and performsthe data transfer from the USB Host to the direction of the USBFunction.

On the other hand, in FIG. 2B, the End Point 1 has the setting of BulkIn, and performs the data transfer from the USB Function to thedirection of the USB Host.

Likewise, in FIG. 2A, the End Point 2 has the setting of Bulk In, andperforms the data transfer from the USB Function to the direction of theUSB Host.

On the hand, in FIG. 2B, the End Point 2 has the setting of Bulk Out,and performs the data transfer from the USB Host to the USB Function.

Subsequently, a transferring operation of print data from the PC will bedescribed along a time axis with reference to FIGS. 3A to 3D.

The setting of the MFP 1000 corresponds to that shown in FIG. 2A. Thatis, the print data to be transferred from the PC is stored in the bufferof the End Point 1 set to the Bulk Out, and further transferred to theRAM 103 by the DMAC.

The End Point 1 232 performs the data transfer from the USB Host calledthe Bulk Out to the direction of the USB Function.

The End Point 1 comprises a buffer for temporarily storing the transferdata on the USB, and the DMAC for performing the data transfer to theRAM 103.

The End Point 2 233 performs the data transfer from the USB Functioncalled the Bulk In to the direction of the USB Host.

In FIG. 3A, the print data are stored in all the buffers of the EndPoint 1. In this case, the USB Function sends a response indicating thatdata is not acceptable (i.e., a retransmission request after a certaininterval) to the USB Host.

In FIGS. 3B and 3C, it can be understood, by the data transfer from theRAM 103 to the next image processing unit 104, that the data in thebuffers of the End Point 1 and the RAM 103 reduce.

In FIG. 3D, it can be understood that there is no data in the buffers ofthe End Point 1, and the data still remains in the RAM 103.

Subsequently, operations in the whole system including the PC (USB Host)and the MFP (USB Function) will be described with reference to FIG. 4.

That is, FIG. 4 is the sequence diagram for describing an example of theinformation process by the PC and the MFP along with a time axis.

In FIG. 4, it is assumed that time advances downward along the verticalaxis. On this assumption, the operation to be performed by the PC 2000is shown on the left, and the operation to be performed by the MFP 1000is shown on the right.

The USB data transfer is performed by the following procedure.

In S3000, the PC 2000 transmits data.

In S4000, when the data is receivable, that is, when there is an emptybuffer in the End Point 1, the MFP 1000 returns an ACK (ACKnoweledge) tothe PC. Here, the ACK is an example of an ACK response.

In S4010, the MFP 1000 transfers the received data to the RAM 103serving as a data storage area.

In S3010, the PC 2000 transmits next data.

In S4020, when the data is receivable, that is, when there is still anempty buffer in the End Point 1, the MFP 1000 returns the ACK to the PC.

In S4030, the MFP 1000 transfers the received data to the RAM 103serving as the data storage area.

Here, when the data is received from the PC 2000, the MFP 1000 starts aninternal timer for which time has previously been set. Morespecifically, the internal timer is restarted when the next data isreceived from the PC 2000.

The above operation processes are repeated by the PC 2000 and the MFP1000 until data to be transmitted becomes zero.

Next, in S3020, the PC 2000 transmits an Alternate changeover requestfor changing over the setting of the End Point.

In S4040, the MFP 1000 decides whether or not the data transfer to theRAM 103 serving as the data storage area has been ended. That is, theMFP decides whether or not the buffer in the End Point 1 is empty.

In S4050, if the data still remains in the buffer, the MFP 1000 returnsa NACK (Negative ACKnowledgment), i.e., a retransmission request, to thePC. Here, the NACK is an example of a NACK response.

In S3030, after elapsing a certain time, the PC 2000 retransmits theAlternate changeover request for changing over the setting of the EndPoint.

In S4060, the MFP 1000 again decides whether or not the data transfer tothe RAM 103 serving as the data storage area has been ended. That is,the MFP again decides whether or not the buffer in the End Point 1 isempty.

In S4070, if there is no data in the buffer, the MFP 1000 returns theACK to the PC.

In S4080, the MFP 1000 initializes the End Point, and changes over thesetting.

Subsequently, the operation of the MFP will be described with referenceto FIG. 5.

That is, FIG. 5 is the flow chart for describing the response operationto the Alternate changeover request to be performed by the MFP 1000.

In S501, the CPU 101 decides whether or not the transfer of the USB datais started. If it is decided by the CPU 101 that the transfer of the USBdata is started (YES in S501), the process is advanced to S502. On theother hand, if it is decided that the transfer of the USB data is notstarted (NO in S501), the process of S501 is repeated.

In S502, the CPU 101 receives the data from the PC 2000 serving as theUSB Host, and stores the received data in the buffer of the End Point 1.

Subsequently, in S503, the CPU 101 transfers the data stored in thebuffer of the End Point 1 to the RAM 103 serving as the data storagearea.

Subsequently, in S504, the CPU 101 decides whether the next USB data isreceived or timeout occurs. Then, if it is decided by the CPU 101 thatthe next USB data is received (USB DATA RECEPTION in S504), the processis advanced to S505. On the other hand, if it is decided that thetimeout occurs (TIMEOUT in S504), the operation illustrated in FIG. 5 isended.

In S505, the CPU 101 decides whether or not the received data is thedata indicating the Alternate changeover request. If it is decided bythe CPU 101 that the received data is the data indicating the Alternatechangeover request (YES in S505), the process is advanced to S506. Onthe other hand, if it is decided that the received data is not the dataindicating the Alternate changeover request (NO in S505), the process isreturned to S502.

In S506, the CPU 101 decides whether or not the data transfer from thebuffer of the End Point 1 to the RAM 103 serving as the data storagearea is ended, that is, the CPU decides whether or not the data stillremains in the buffer. Then, if it is decided by the CPU 101 that thedata transfer is ended (YES in S506), the process is advanced to S508.On the other hand, if it is decided that the data transfer is not ended(NO in S506), the process is advanced to S507.

In S507, the CPU 101 returns the NACK, i.e., the retransmission request,to the PC 2000, and the process is returned to S505. In response to theNACK, the PC 2000 retransmits, after elapsing a certain time, theAlternate changeover request for changing over the setting of the EndPoint.

On the other hand, in S508, the CPU 101 returns the ACK to the PC 2000.

In S509, the CPU 101 initializes the End Point, and changes over thesetting.

As described above, according to the present embodiment, in the casewhere the Alternate changeover request is received from the PC being thehost apparatus, if the data transfer to the internal memory is not yetended, the following operations are possible. That is, it is possible toreturn the retransmission request to the PC. Further, by returning theretransmission request, it is possible to perform the response withinthe response time on the USB. Furthermore, by returning theretransmission request, it is possible to delay the Alternatechangeover. Furthermore, by returning the retransmission request, it ispossible to delay the Alternate changeover and appropriately end thetransfer of the internal memory. Furthermore, by returning theretransmission request, it is possible to prevent that the data is lostin the initialization of the End Point by the Alternate changeover.

Incidentally, in the present embodiment, the CPU 101 transmits the ACKand the NACK according to the USB 2.0 standard.

However, in case of Super Speed according to the USB 3.0 standard, ifthe CPU 101 uses a response (e.g., NRDY (NotReaDY) corresponding to therelevant standard, it is possible to perform the control same as that inthe present embodiment. Here, the reply by the NRDY is an example of anNRDY response.

Other Embodiments

The present invention can also be achieved by a process of supplying theprogram for achieving one or more functions of the above embodiment to asystem or an apparatus via a network or a storage medium and causing oneor more processors of the computer of the system or the apparatus toread and execute the supplied program. Besides, the present inventioncan also be achieved by a circuit (e.g., ASIC (application specificintegrated circuit)) of achieving one or more functions.

As described above, according to the embodiments of the presentinvention, it is possible to prevent that the data is lost even when thechangeover of the setting of the buffer is instructed.

Embodiment(s) of the present invention can also be realized by acomputer of a system or apparatus that reads out and executes computerexecutable instructions (e.g., one or more programs) recorded on astorage medium (which may also be referred to more fully as a‘non-transitory computer-readable storage medium’) to perform thefunctions of one or more of the above-described embodiment(s) and/orthat includes one or more circuits (e.g., application specificintegrated circuit (ASIC)) for performing the functions of one or moreof the above-described embodiment(s), and by a method performed by thecomputer of the system or apparatus by, for example, reading out andexecuting the computer executable instructions from the storage mediumto perform the functions of one or more of the above-describedembodiment(s) and/or controlling the one or more circuits to perform thefunctions of one or more of the above-described embodiment(s). Thecomputer may comprise one or more processors (e.g., central processingunit (CPU), micro processing unit (MPU)) and may include a network ofseparate computers or separate processors to read out and execute thecomputer executable instructions. The computer executable instructionsmay be provided to the computer, for example, from a network or thestorage medium. The storage medium may include, for example, one or moreof a hard disk, a random-access memory (RAM), a read only memory (ROM),a storage of distributed computing systems, an optical disk (such as acompact disc (CD), digital versatile disc (DVD), or Blu-ray Disc (BD)™),a flash memory device, a memory card, and the like.

While the present invention has been described with reference toexemplary embodiments, it is to be understood that the invention is notlimited to the disclosed exemplary embodiments. The scope of thefollowing claims is to be accorded the broadest interpretation so as toencompass all such modifications and equivalent structures andfunctions.

This application claims the benefit of Japanese Patent Application No.2014-197339, filed Sep. 26, 2014, which is hereby incorporated byreference herein in its entirety.

What is claimed is:
 1. An information processing apparatus comprising: amemory; a universal serial bus (USB) communicator that communicates withan external apparatus via a USB cable, wherein data received by the USBcommunicator is stored in an end point of the USB communicator, and thedata stored in the end point is transferred to the memory; and aprocessor that executes programs to: determine whether or not the datahas been stored in the end point when a changeover request indicating tochange over setting of the end point is received from the externalapparatus by the USB communicator, wherein the data stored in the endpoint is lost when the setting of the end point is changed over; andtransmit a Negative ACKnowledgment (NACK) to the external apparatus viathe USB cable, when it is determined that the data has been stored inthe end point, wherein, when it is determined that the data has beenstored in the end point, the changeover of the setting of the end pointbased on the changeover request is not performed.
 2. The informationprocessing apparatus according to claim 1, wherein the memory includes aRAM (random access memory).
 3. The information processing apparatusaccording to claim 1, wherein the information processing apparatus is aprinting apparatus capable of performing printing, and the USBcommunicator receives print data from the external apparatus via the USBcable.
 4. The information processing apparatus according to claim 1,wherein the processor further executes the programs to transmit anACKnowledgment (ACK) to the external apparatus via the USB cable, whenit is determined that the data is not stored in the end point, and whenit is determined that the data is not stored in the end point, thechangeover of the setting of the end point based on the changeoverrequest is performed.
 5. A controlling method for an informationprocessing apparatus which stores data received by a universal serialbus (USB) communicator for communicating with an external apparatus viaa USB cable in an end point of the USB communicator, and furthertransfers the data stored in the end point to a memory, the controllingmethod comprising: receiving a changeover request indicating to changeover setting of the end point, from the external apparatus by the USBcommunicator; determining whether or not the data has been stored in theend point, when the changeover request is received, wherein the datastored in the end point is lost when the setting of the end point ischanged over; and transmitting a Negative ACKnowledgment (NACK) to theexternal apparatus via the USB cable, when it is determined that thedata has been stored in the end point, wherein, when it is determinedthat the data has been stored in the end point, the changeover of thesetting of the end point based on the changeover request is notperformed.
 6. A non-transitory computer-readable storage medium ofstoring a program to perform a controlling method for an informationprocessing apparatus which stores data received by a universal serialbus (USB) communicator for communicating with an external apparatus viaa USB cable in an end point of the USB communicator, and transfers thedata stored in the end point to a memory, the controlling methodcomprising: receiving a changeover request indicating to change oversetting of the end point, from the external apparatus by the USBcommunicator; determining whether or not the data has been stored in theend point, when the changeover request is received, wherein the datastored in the end point is lost when the setting of the end point ischanged over; and transmitting a Negative ACKnowledgment (NACK) to theexternal apparatus via the USB cable, when it is determined that thedata has been stored in the end point, wherein, when it is determinedthat the data has been stored in the end point, the changeover of thesetting of the end point based on the changeover request is notperformed.